package com.xiaochong.tir.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.common.data.mapper.ListedCompanyIndexMapper;
import com.xiaochong.tir.common.data.mapper.ListedCompanyIndexMapper;
import com.xiaochong.tir.common.data.mapper.NonListedCompanyIndexMapper;
import com.xiaochong.tir.common.data.po.ListedCompanyIndex;
import com.xiaochong.tir.common.data.po.ListedCompanyIndex;
import com.xiaochong.tir.manager.config.druid.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 此类为[基础代码]自动生成,已经拥有基本的增删改成操作 
 * <其他请自行扩展>
 * @author cx
 * @time 2018-04-26 09:56
 * 
 */
@Service
public class ABlockIndexService {

    @Autowired
    private ListedCompanyIndexMapper listedCompanyIndexMapper;

	
	/**
     * 新增
     * @param entity 
     * @param
     */
	@Operation
    @Transactional
    public int insertSelective (ListedCompanyIndex entity) { 
     return this.listedCompanyIndexMapper.insertSelective(entity);
    }	
    
    /**
     * 批量新增
     * @param list 
     * @param
     */
    public void insertBatch(List<ListedCompanyIndex> list) {
           
          this.listedCompanyIndexMapper.insertBatch(list);

    }
    
    /**
     * 根据主键修改单条数据
     * @param entity 
     * @param
     */
    @Operation
    @Transactional
    public int updateByPrimaryKey(ListedCompanyIndex entity,ListedCompanyIndex old) {
           return this.listedCompanyIndexMapper.updateByPrimaryKey(entity);
    }
    
    /**
     * 根据主键批量修改数据
     * @param list 
     * @param
     */
    public void updateBatch(List<ListedCompanyIndex> list) {
           
          this.listedCompanyIndexMapper.updateBatch(list);
    }
    
    /**
     * 根据主键查询单条数据
     * @param id
     */
    public ListedCompanyIndex selectByPrimaryKey(Integer id) {
            return this.listedCompanyIndexMapper.selectByPrimaryKey(id);
    }
    
    /**
     * 根据条件查询单条记录
     * @param entity 
     */
    public ListedCompanyIndex selectByEntity(ListedCompanyIndex entity) {
           return this.listedCompanyIndexMapper.selectByEntity(entity);
    }

    
    /**
     * 根据条件查询Id
     * @param entity 
     */
    public Integer selectById(ListedCompanyIndex entity) {
           return  this.listedCompanyIndexMapper.selectById(entity);
    }
    
     /**
     * 根据条件查询Ids
     * @param entity 
     */
    public List<Integer> selectByIds(ListedCompanyIndex entity) {
        return  this.listedCompanyIndexMapper.selectByIds(entity);
    }
    
     /**
     * 根据主键删除单条记录
     * @param id
     */
    @Operation
    @Transactional
    public void deleteByPrimaryKey(Integer id,ListedCompanyIndex old) {
           this.listedCompanyIndexMapper.deleteByPrimaryKey(id);
    }
    
    /**
     * 根据主键删除多条记录
     * @param list
     */
    public void deleteBatch(List<Integer> list) {
           this.listedCompanyIndexMapper.deleteBatch(list);
    }
    
     /**
     * 根据某些条件删除
     * @param entity
     */
    public void deleteBatch(ListedCompanyIndex entity) {
           this.listedCompanyIndexMapper.deleteByEntity(entity);
    }


    /**
     * 根据条件查询多条记录
     * @param entity
     */
    public List<ListedCompanyIndex> selectByEntityList(ListedCompanyIndex entity) {
        return this.listedCompanyIndexMapper.selectByEntityList(entity);
    }

    public PageInfo<ListedCompanyIndex> selectByListedList(ListedCompanyIndex listedCompanyIndex) {
        PageHelper.startPage(listedCompanyIndex.getPageIndex(), listedCompanyIndex.getPageSize());
        List<ListedCompanyIndex> ll = this.listedCompanyIndexMapper.selectByListedList(listedCompanyIndex);
        PageInfo<ListedCompanyIndex> list = new PageInfo<ListedCompanyIndex>(ll);
        return list;
    }
}